package com.example.community.del;

import com.example.community.dao.ParkingDao;
import com.example.community.dao.RoomDao;
import com.example.community.dao.UsersDao;
import com.example.community.model.Users;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/userDeleteServlet")
public class UserDeleteServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try{
            String usNo = req.getParameter("usNo");
            UsersDao usersDao = new UsersDao();
            Integer delete = usersDao.delete(Integer.parseInt(usNo));
            if (delete == 1){
                resp.getWriter().write("true");
            }else {
                resp.getWriter().write("false");
            }
        }catch (Exception e){
            resp.getWriter().write("qita");
        }
    }
}
